home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
src
/
Tools
/
vuser
/
main.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-20
|
3KB
|
105 lines
/* main.c - This module contains the startup code for the vuser program.
Copyright 1989 by Jeffrey F. Lawhorn (jeffl@berick.uucp)
This file is part of vuser.
vuser is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your
option) any later version.
vuser is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to the
Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(lint)
static char SCCSid[] = "$Id: main.c,v 1.1 89/12/15 21:30:53 jeffl Exp $";
#endif
#include <stdio.h>
#include <signal.h>
#if defined(__STDC__)
extern void Tty2ProgramMode();
extern void GetPty();
extern void StartSlave();
extern void HaveFun();
#else
extern void Tty2ProgramMode();
extern void GetPty();
extern void StartSlave();
extern void HaveFun();
#endif
extern char *optarg;
extern int optind;
extern int PromptSize;
extern char **Program2Run;
extern char *RloginProgram[];
#if defined(TIMEOUT_IS_LONG)
extern long TimeOut;
#else
#include <sys/time.h>
extern struct timeval TimeOut;
#endif
FILE *ScriptFile = (FILE *)NULL;
FILE *RecordFile = (FILE *)NULL;
main(argc, argv)
int argc;
char *argv[];
{
loop: switch(getopt(argc, argv, "s:p:t:e:l:r:")) {
case EOF: break;
case 's': {
if(!(ScriptFile = fopen(optarg, "w"))) {
perror(optarg);
exit(1);
}
goto loop;
}
case 'p': {
if((PromptSize = atoi(optarg)) > 4096) {
fprintf(stderr, "Prompt size is limited to 4096.\n");
PromptSize = 4096;
}
goto loop;
}
#if defined(TIMEOUT_IS_LONG)
case 't': TimeOut = atol(optarg); goto loop;
#else
case 't': TimeOut.tv_sec = atol(optarg); goto loop;
#endif
case 'e': Program2Run = &argv[optind - 1]; break;
case 'l': {
RloginProgram[2] = argv[optind];
RloginProgram[4] = argv[optind - 1];
break;
}
case 'r': {
if(!(RecordFile = fopen(optarg, "w"))) {
perror(optarg);
exit(1);
}
goto loop;
}
default: exit(1);
}
setbuf(stdin, (char *)NULL);
signal(SIGINT, SIG_IGN);
Tty2ProgramMode();
GetPty();
StartSlave();
HaveFun();
}